import {topic_resolve, 对象生成器} from "../解析器";
import {通用Topic} from "../题目类型标准/通用Topic";// @ts-ignore
import {ITopic_Enum, topic_original} from "../Topic.ts";
import {ref,h} from "vue";

export const 对象生成器_通用Topic:对象生成器<通用Topic,topic_original> = {
	itopic_enum: ITopic_Enum.通用Topic,
	try_as(s: topic_resolve) {
		let a =new 通用Topic();
		a.topic.topic_original.value = s.topic;
		a.resolve.value = s.resolve;
		a.tag={
			TagNote:{
				text:ref(""),
				switch_editor:ref(false)
			},
			TagWrongCount:ref(0)
		}
		return a;
	},
	try_ass(s: topic_resolve[]) {
		let a:通用Topic[] = [];
		for (let v of s){
			let b = this.try_as(v);
			if(b==null){
				console.warn("生成失败一位")//todo 改成弹框
			}else {
				a.push(b);
			}
		}
		return a;
	},
	as_examplen(){
		return h('p',()=>"懒的写")
	}
}